home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Bus / S / Stock HELPER®.cpt / Stock HELPERÆ V0.2 / background_14235.txt < prev    next >
Text File  |  1988-03-23  |  11KB  |  502 lines

  1. -- background: 14235 from stack: in.2
  2. -- bmap block id: 35610
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Stock Chart
  6. ----- HyperTalk script -----
  7. on openBackground
  8.   push recent card
  9. end openBackground
  10.  
  11. function frameheight
  12. return 235
  13. end frameheight
  14.  
  15. function framewidth
  16. return 400
  17. end framewidth
  18.  
  19. function framebottom
  20. return 275
  21. end framebottom
  22.  
  23. function frameleft
  24. return 1
  25. end frameleft
  26.  
  27. on OpenCard
  28.   global lineCount
  29.   put the number of lines of field "Data" into lineCount
  30.   repeat with i=1 to 3
  31.     arrowDirection i
  32.   end repeat
  33.   SetforUpdate
  34. end OpenCard
  35.  
  36. on AddDate startDate
  37.   put startDate into newDate
  38.   convert newDate to seconds
  39.   put 7*24*3600 into aWeek -- seconds in a week
  40.   put the number of lines of field "data" into lineCount
  41.   repeat with i=1 to lineCount
  42.     put newDate into currentdate
  43.     convert currentdate to dateItems
  44.     put character 3 to 4 of item 1 of currentDate into year
  45.     put item 2 of currentDate into month
  46.     if month<10 then
  47.       put "0"&month into month
  48.     end if
  49.     put item 3 of currentDate into day
  50.     if day<10 then
  51.       put "0"&day into day
  52.     end if
  53.     get line i of field "data"
  54.     put year&month&day&","&it into line i of field "data"
  55.     add aWeek to newDate
  56.   end repeat
  57. end AddDate
  58.  
  59. on RedoDate startDate
  60.   set the cursor to 4
  61.   put startDate into newDate
  62.   convert newDate to seconds
  63.   put 7*24*3600 into aWeek -- seconds in a week
  64.   put the number of lines of field "data" into lineCount
  65.   repeat with i=1 to lineCount
  66.     put newDate into currentdate
  67.     convert currentdate to dateItems
  68.     put character 3 to 4 of item 1 of currentDate into year
  69.     put item 2 of currentDate into month
  70.     if month<10 then
  71.       put "0"&month into month
  72.     end if
  73.     put item 3 of currentDate into day
  74.     if day<10 then
  75.       put "0"&day into day
  76.     end if
  77.     get line i of field "data"
  78.     put year&month&day into item 1 of line i of field "data"
  79.     add aWeek to newDate
  80.   end repeat
  81. end RedoDate
  82.  
  83.  
  84.  
  85. -- part 1 (button)
  86. -- low flags: 00
  87. -- high flags: 0000
  88. -- rect: left=67 top=317 right=336 bottom=87
  89. -- title width / last selected line: 0
  90. -- icon id / first selected line: 1014 / 1014
  91. -- text alignment: 1
  92. -- font id: 0
  93. -- text size: 12
  94. -- style flags: 0
  95. -- line height: 16
  96. -- part name: Prev
  97. ----- HyperTalk script -----
  98. on mouseUp
  99.   global firstChart
  100.   visual effect wipe left
  101.   if the number of this card > firstChart then
  102.     go to previous card
  103.   else
  104.     go card "Title Card"
  105.   end if
  106. end mouseUp
  107.  
  108.  
  109. -- part 2 (button)
  110. -- low flags: 00
  111. -- high flags: 0000
  112. -- rect: left=5 top=319 right=338 bottom=25
  113. -- title width / last selected line: 0
  114. -- icon id / first selected line: 21700 / 21700
  115. -- text alignment: 1
  116. -- font id: 0
  117. -- text size: 12
  118. -- style flags: 0
  119. -- line height: 16
  120. -- part name: Home
  121. ----- HyperTalk script -----
  122. on mouseUp
  123.   visual effect iris close
  124.   go home
  125. end mouseUp
  126.  
  127.  
  128.  
  129.  
  130. -- part 4 (button)
  131. -- low flags: 00
  132. -- high flags: 0000
  133. -- rect: left=423 top=319 right=338 bottom=443
  134. -- title width / last selected line: 0
  135. -- icon id / first selected line: 1013 / 1013
  136. -- text alignment: 1
  137. -- font id: 0
  138. -- text size: 12
  139. -- style flags: 0
  140. -- line height: 16
  141. -- part name: Next
  142. ----- HyperTalk script -----
  143. on mouseUp
  144.   global firstChart
  145.   visual effect wipe right
  146.   if the number of this card < the number of cards then
  147.     go to next card
  148.   else
  149.     go card "Title Card"
  150.   end if
  151. end mouseUp
  152.  
  153.  
  154. -- part 5 (field)
  155. -- low flags: 00
  156. -- high flags: 4007
  157. -- rect: left=88 top=278 right=342 bottom=423
  158. -- title width / last selected line: 0
  159. -- icon id / first selected line: 0 / 0
  160. -- text alignment: 0
  161. -- font id: 3
  162. -- text size: 12
  163. -- style flags: 0
  164. -- line height: 16
  165. -- part name: Data
  166. ----- HyperTalk script -----
  167. on CountItems
  168.   global highItem,lowItem,closeItem,itemCount
  169.   put the number of items of line 1 of field "data" into itemCount
  170.   put 1 into highItem
  171.   put 1 into lowItem
  172.   put 1 into closeItem
  173.   if itemCount = 5 then
  174.     put 3 into highItem
  175.     put 4 into lowItem
  176.     put 5 into closeItem
  177.   else
  178.     if itemCount>1 then
  179.       put 2 into highItem
  180.       put 2 into lowItem
  181.       put 2 into closeItem
  182.     end if
  183.   end if
  184. end CountItems
  185.  
  186. on CloseField
  187.   global highItem,lowItem,closeItem
  188.   set the Cursor to 4
  189.   TrimDataPoints
  190.   CountItems
  191.   if closeItem>1 then
  192.     put item 1 of last line of field "data" into field "Date of Last Update"
  193.   else
  194.     put empty into field "Date of Last Update"
  195.   end if
  196.   put maxLine(field "Data",highitem) into field "High"
  197.   put MinLine(field "data",lowItem) into field "Low"
  198.   put item closeItem of last line of field "data" into field "Close"
  199. end CloseField
  200.  
  201.  
  202. -- part 6 (button)
  203. -- low flags: 00
  204. -- high flags: A001
  205. -- rect: left=448 top=278 right=325 bottom=485
  206. -- title width / last selected line: 0
  207. -- icon id / first selected line: 12074 / 12074
  208. -- text alignment: 1
  209. -- font id: 0
  210. -- text size: 12
  211. -- style flags: 0
  212. -- line height: 16
  213. -- part name: Plot
  214. ----- HyperTalk script -----
  215. on mouseUp
  216.   global upArrow,downArrow,lineCount,itemCount
  217.   global span1,span2,span3
  218.   put the userLevel into saveLevel
  219.   if the userLevel < 3 then set userLevel to 3 -- "Painting"
  220.   set the cursor to 4
  221.   clearScreen
  222.   reset paint
  223.   choose line tool
  224.   set lineSize to 1
  225.   set pattern to 14
  226.   set filled to true
  227.   put frameleft()+3 into horiz
  228.   send closeField to field "Data"
  229.   put the number of items in line 1 of field "Data" into itemCount
  230.   put 6 into horizStep
  231.   put round(horizStep * 3/4) into width
  232.   put 0 into sum5
  233.   put 0 into sum15
  234.   put 0 into sum40
  235.   put field "High" into maxValue
  236.   repeat with i = 1 to lineCount
  237.     get item itemCount of line i of field "data"
  238.     if it is not empty then
  239.       put round(frameheight() * it / maxValue) into height
  240.       drag from horiz,framebottom()-height to horiz,framebottom()-height+width
  241.       put round(height-width/2) into height
  242.       drag from horiz,framebottom()-height to horiz+2,framebottom()-height
  243.       if i>lineCount-span3 then
  244.         add it to sum40
  245.         if i>lineCount-span2 then
  246.           add it to sum15
  247.           if i>lineCount-span1 then
  248.             add it to sum5
  249.           end if
  250.         end if
  251.       end if
  252.     end if
  253.     add horizStep to horiz
  254.   end repeat
  255.   movingAverage sum5,1,span1,itemCount
  256.   movingAverage sum15,2,span2,itemCount
  257.   movingAverage sum40,3,span3,itemCount
  258.   reset paint
  259.   choose browse tool
  260.   set userLevel to saveLevel
  261. end mouseUp
  262.  
  263.  
  264.  
  265.  
  266. -- part 10 (field)
  267. -- low flags: 00
  268. -- high flags: 0002
  269. -- rect: left=99 top=20 right=38 bottom=413
  270. -- title width / last selected line: 0
  271. -- icon id / first selected line: 0 / 0
  272. -- text alignment: 0
  273. -- font id: 2
  274. -- text size: 12
  275. -- style flags: 256
  276. -- line height: 16
  277. -- part name: Stock Name
  278.  
  279.  
  280. -- part 11 (field)
  281. -- low flags: 00
  282. -- high flags: 0002
  283. -- rect: left=0 top=20 right=38 bottom=100
  284. -- title width / last selected line: 0
  285. -- icon id / first selected line: 0 / 0
  286. -- text alignment: 0
  287. -- font id: 2
  288. -- text size: 12
  289. -- style flags: 256
  290. -- line height: 16
  291. -- part name: Stock Symbol
  292.  
  293.  
  294. -- part 12 (field)
  295. -- low flags: 00
  296. -- high flags: 0002
  297. -- rect: left=412 top=20 right=38 bottom=512
  298. -- title width / last selected line: 0
  299. -- icon id / first selected line: 0 / 0
  300. -- text alignment: 0
  301. -- font id: 2
  302. -- text size: 12
  303. -- style flags: 256
  304. -- line height: 16
  305. -- part name: Date of last update
  306.  
  307.  
  308. -- part 13 (field)
  309. -- low flags: 00
  310. -- high flags: 0000
  311. -- rect: left=412 top=37 right=55 bottom=512
  312. -- title width / last selected line: 0
  313. -- icon id / first selected line: 0 / 0
  314. -- text alignment: 0
  315. -- font id: 3
  316. -- text size: 10
  317. -- style flags: 256
  318. -- line height: 13
  319. -- part name: High
  320.  
  321.  
  322. -- part 14 (field)
  323. -- low flags: 00
  324. -- high flags: 0000
  325. -- rect: left=412 top=54 right=72 bottom=512
  326. -- title width / last selected line: 0
  327. -- icon id / first selected line: 0 / 0
  328. -- text alignment: 0
  329. -- font id: 3
  330. -- text size: 10
  331. -- style flags: 256
  332. -- line height: 13
  333. -- part name: Low
  334.  
  335.  
  336. -- part 15 (field)
  337. -- low flags: 00
  338. -- high flags: 0000
  339. -- rect: left=412 top=71 right=89 bottom=512
  340. -- title width / last selected line: 0
  341. -- icon id / first selected line: 0 / 0
  342. -- text alignment: 0
  343. -- font id: 3
  344. -- text size: 10
  345. -- style flags: 256
  346. -- line height: 13
  347. -- part name: Close
  348.  
  349.  
  350. -- part 23 (field)
  351. -- low flags: 00
  352. -- high flags: 0000
  353. -- rect: left=411 top=121 right=139 bottom=499
  354. -- title width / last selected line: 0
  355. -- icon id / first selected line: 0 / 0
  356. -- text alignment: 0
  357. -- font id: 3
  358. -- text size: 10
  359. -- style flags: 256
  360. -- line height: 13
  361. -- part name: Average 1
  362.  
  363.  
  364. -- part 24 (field)
  365. -- low flags: 00
  366. -- high flags: 0000
  367. -- rect: left=411 top=138 right=156 bottom=499
  368. -- title width / last selected line: 0
  369. -- icon id / first selected line: 0 / 0
  370. -- text alignment: 0
  371. -- font id: 3
  372. -- text size: 10
  373. -- style flags: 256
  374. -- line height: 13
  375. -- part name: Average 2
  376.  
  377.  
  378. -- part 25 (field)
  379. -- low flags: 00
  380. -- high flags: 0000
  381. -- rect: left=411 top=155 right=172 bottom=499
  382. -- title width / last selected line: 0
  383. -- icon id / first selected line: 0 / 0
  384. -- text alignment: 0
  385. -- font id: 3
  386. -- text size: 10
  387. -- style flags: 256
  388. -- line height: 13
  389. -- part name: Average 3
  390.  
  391.  
  392. -- part 28 (button)
  393. -- low flags: 00
  394. -- high flags: 0000
  395. -- rect: left=497 top=155 right=171 bottom=511
  396. -- title width / last selected line: 0
  397. -- icon id / first selected line: 16692 / 16692
  398. -- text alignment: 1
  399. -- font id: 0
  400. -- text size: 12
  401. -- style flags: 0
  402. -- line height: 16
  403. -- part name: direction 3
  404. ----- HyperTalk script -----
  405. on mouseUp
  406. end mouseUp
  407.  
  408.  
  409.  
  410. -- part 29 (button)
  411. -- low flags: 00
  412. -- high flags: 0000
  413. -- rect: left=497 top=138 right=154 bottom=511
  414. -- title width / last selected line: 0
  415. -- icon id / first selected line: 16692 / 16692
  416. -- text alignment: 1
  417. -- font id: 0
  418. -- text size: 12
  419. -- style flags: 0
  420. -- line height: 16
  421. -- part name: direction 2
  422. ----- HyperTalk script -----
  423. on mouseUp
  424. end mouseUp
  425.  
  426.  
  427.  
  428. -- part 30 (button)
  429. -- low flags: 00
  430. -- high flags: 0000
  431. -- rect: left=497 top=121 right=137 bottom=511
  432. -- title width / last selected line: 0
  433. -- icon id / first selected line: 16692 / 16692
  434. -- text alignment: 1
  435. -- font id: 0
  436. -- text size: 12
  437. -- style flags: 0
  438. -- line height: 16
  439. -- part name: direction 1
  440. ----- HyperTalk script -----
  441. on mouseUp
  442. end mouseUp
  443.  
  444.  
  445.  
  446. -- part 31 (field)
  447. -- low flags: 81
  448. -- high flags: 0000
  449. -- rect: left=156 top=120 right=169 bottom=290
  450. -- title width / last selected line: 0
  451. -- icon id / first selected line: 0 / 0
  452. -- text alignment: 0
  453. -- font id: 3
  454. -- text size: 12
  455. -- style flags: 0
  456. -- line height: 16
  457. -- part name: Directions
  458.  
  459.  
  460. -- part 32 (button)
  461. -- low flags: 00
  462. -- high flags: 8000
  463. -- rect: left=28 top=278 right=322 bottom=60
  464. -- title width / last selected line: 65535
  465. -- icon id / first selected line: -6047 / 59489
  466. -- text alignment: 1
  467. -- font id: 0
  468. -- text size: 12
  469. -- style flags: 0
  470. -- line height: 16
  471. -- part name: Import
  472. ----- HyperTalk script -----
  473. on mouseUp
  474.   ask "File Name" with "Interchange:"
  475.   put it into fileName
  476.   open file fileName
  477.   read from file fileName for 32000
  478.   put it into field "data"
  479.   close file fileName
  480.   send closeField to field "data"
  481. end mouseUp
  482.  
  483.  
  484.  
  485. -- part 33 (button)
  486. -- low flags: 00
  487. -- high flags: 2000
  488. -- rect: left=492 top=319 right=338 bottom=510
  489. -- title width / last selected line: 0
  490. -- icon id / first selected line: 1012 / 1012
  491. -- text alignment: 1
  492. -- font id: 0
  493. -- text size: 12
  494. -- style flags: 0
  495. -- line height: 16
  496. -- part name: To Title Card
  497. ----- HyperTalk script -----
  498. on mouseUp
  499.   go to card "Title Card"
  500. end mouseUp
  501.  
  502.